<!DOCTYPE html>
<html style="overflow-x:auto;overflow-y:auto;"><head>
    <title>活动信息管理 - Powered By 智能数据</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"><meta name="author" content="http://jeesite.com/">
    <meta name="renderer" content="webkit"><meta http-equiv="X-UA-Compatible" content="IE=8,IE=9,IE=10">
    <meta http-equiv="Expires" content="0"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Cache-Control" content="no-store">
    <script src="http://mis.ultradata.cn/DSP/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
    <link href="http://mis.ultradata.cn/DSP/static/bootstrap/2.3.1/css_default/bootstrap_new.css" type="text/css" rel="stylesheet" />
    <link href="http://mis.ultradata.cn/DSP/static/bootstrap/2.3.1/css_default/dsp-style_new.css" type="text/css" rel="stylesheet" />

    <script src="http://mis.ultradata.cn/DSP/static/bootstrap/2.3.1/js/bootstrap.min.js" type="text/javascript"></script>
    <link href="http://mis.ultradata.cn/DSP/static/bootstrap/2.3.1/awesome/font-awesome.min.css" type="text/css" rel="stylesheet" />
    <!--[if lte IE 7]><link href="http://mis.ultradata.cn/DSP/static/bootstrap/2.3.1/awesome/font-awesome-ie7.min.css" type="text/css" rel="stylesheet" /><![endif]-->
    <!--[if lte IE 6]><link href="http://mis.ultradata.cn/DSP/static/bootstrap/bsie/css/bootstrap-ie6.min.css" type="text/css" rel="stylesheet" />
<script src="http://mis.ultradata.cn/DSP/static/bootstrap/bsie/js/bootstrap-ie.min.js" type="text/javascript"></script><![endif]-->
    <link href="http://mis.ultradata.cn/DSP/static/jquery-select2/3.4/select2.css" rel="stylesheet" />
    <script src="http://mis.ultradata.cn/DSP/static/jquery-select2/3.4/select2.min.js" type="text/javascript"></script>
    <link href="http://mis.ultradata.cn/DSP/static/jquery-validation/1.11.0/jquery.validate.min.css" type="text/css" rel="stylesheet" />
    <script src="http://mis.ultradata.cn/DSP/static/jquery-validation/1.11.0/jquery.validate.js" type="text/javascript"></script>
    <link href="http://mis.ultradata.cn/DSP/static/jquery-jbox/2.3/Skins/Bootstrap/jbox.css" rel="stylesheet" />
    <script src="http://mis.ultradata.cn/DSP/static/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>
    <script src="http://mis.ultradata.cn/DSP/static/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="http://mis.ultradata.cn/DSP/static/common/mustache.min.js" type="text/javascript"></script>
    <link href="http://mis.ultradata.cn/DSP/static/common/jeesite.css" type="text/css" rel="stylesheet" />
    <script src="http://mis.ultradata.cn/DSP/static/common/jeesite.js" type="text/javascript"></script>
    <script type="text/javascript">var ctx = '/DSP', ctxStatic='/DSP/static';</script>
    <link rel="icon" type="image/x-icon" href="http://mis.ultradata.cn/DSP/static/favicon.ico">
    <!-- 自定义时间kongjian -->
    <link href="http://mis.ultradata.cn/DSP/static/common/daterangepicker-bs3.css" type="text/css" rel="stylesheet" />
    <link href="http://mis.ultradata.cn/DSP/static/common/daterangepicker-1.3.7.css" type="text/css" rel="stylesheet" />
    <script src="http://mis.ultradata.cn/DSP/static/common/moment.js" type="text/javascript"></script>
    <script src="http://mis.ultradata.cn/DSP/static/common/daterangepicker-1.3.7.js" type="text/javascript"></script>
    <script src="http://mis.ultradata.cn/DSP/static/common/dateList.js" type="text/javascript"></script>


    <meta name="decorator" content="default">
    <style type="text/css">
        .input-group-freq-pos{
            width: 350px;
        }
    </style>
    <script type="text/javascript">
        var ctx='/DSP';
        $(function(){
            $(".rowCellEdit").click(function(){
                var _this=$(this);
                changeStatus();
                _this.parent().hide();
                $('#contentTable').find('.input-group-pos').hide();
                $('#contentTable').find('.input-group-pos').prev().show();
                _this.parent().next().show();
            });

            //编辑 取消
            $(".input-group-remove").click(function(){
                var _this=$(this);
                _this.parent().hide();
                _this.parent().prev().show();
            });
            //编辑 提交
            $("#contentTable .input-group-submit").click(function(){
                var tipEmpty='<p class="tip-danger mt10">不能为空，请输入正确的信息！</p>';
                var notNum='<p class="tip-danger mt10">请输入数字！</p>';
                var reg=new RegExp("^[0-9]+(\.[0-9]+)?$");
                var regTimes=new RegExp('^[1-9]*[1-9][0-9]*$');
                var orderMoney=$(this).parent().find('.frequencyNum-budget-text').val();
                var orderTimes=$(this).parent().find('.frequencyNum-freq-text').val();

                $(this).parent().find('.tip-danger').remove();
                if($(this).parent().find('input[type="text"]').hasClass('frequencyNum-budget-text')){
                    if(orderMoney==''){
                        $(this).parent().append(tipEmpty);
                        return false;
                    }

                    if(reg.test(orderMoney)==false){
                        $(this).parent().append(notNum);
                        return false;
                    }
                }

                if($(this).parent().find('input[type="text"]').hasClass('frequencyNum-freq-text')){
                    if(orderTimes==''){
                        $(this).parent().append(tipEmpty);
                        return false;
                    }

                    if(regTimes.test(orderTimes)==false){
                        $(this).parent().append(notNum);
                        return false;
                    }
                }

                var strObj="{";
                $(this).parent().find('.input').each(function(){
                    if($(this).is('input[type="hidden"]')||$(this).is('input[type="text"]')){
                        var a=$(this).val();
                        var b=$(this).attr('name');
                        strObj+="'"+b+"' :'"+a+"',";
                        //console.log(b+":"+a);
                    }
                    if($(this).is('input[type="radio"]:checked')){
                        var b1=$(this).attr('name');
                        var a1=$(this).val();
                        strObj+="'"+b1+"' :'"+a1+"',";
                        //console.log(b1+":"+a1);
                    }
                    if($(this).is('select')){
                        var b2=$(this).attr('name');
                        var a2=$(this).val();
                        strObj+="'"+b2+"' :'"+a2+"',";
                    }
                });
                strObj=strObj.substr(0,strObj.length-1);
                strObj+="}";
                var obj= eval('(' + strObj + ')');
                $.ajax({
                    url:ctx+'/plan/dspPlan/update',
                    data:obj,
                    type:'post',
                    dataType:'json',
                    success:function(data){
                        location.reload();
                    }
                });

                $(this).parent().hide();
                $(this).parent().prev().show();

            });

        });

        function changeStatus(){
            $(".rowCellEdit-div").show();
            $(".editDiv").hide();
        }

        //改变投放状态 preci 精度  活动  或者 订单
        function exchange(preci,id,ithis){
            $('#order-modal').modal('show');
            $('#order-status').unbind('click').click(function(){
                $('#order-modal').modal('hide');
                changeStatus(preci,id,ithis);
            });
        }

        function  changeStatus(preci,id,ithis){
            if($(ithis).hasClass('plan-state-start')){
                bidStatus='1';
            }else{
                bidStatus='2';
            }

            $.ajax({
                url:ctx+'/plan/dspPlan/updateBidStatus',
                data:{'preci':preci,'id':id,'bidStatus':bidStatus},
                type:'post',
                dataType:'json',
                success:function(data){
                    if(data.success){
                        if($(ithis).hasClass('plan-state-start')){
                            $(ithis).removeClass('plan-state-start');
                        }else{
                            $(ithis).addClass('plan-state-start');
                        }
                        location.reload();
                    }else{
                        //alert("该"+(preci=="order"?"订单":"活动")+"所属广告主已经被禁用，您不能变更竞价状态");
                        var tips='<div class="alert alert-danger order-tip">'
                            +'<button data-dismiss="alert" class="close">×</button>'
                            +'<span>该广告主所属'+(preci=="order"?"订单":"活动")+'已经被禁用，您不能变更竞价状态!</span>'
                            +'</div>';

                        $('#subtips').append(tips);
                        setTimeout(function(){
                            $('#subtips').children().remove();
                        },3000);
                    }

                }
            });
        }

        function appendTB(bidStatus,planId,this_){
            if($(this_).hasClass("icon-plus")){
                $.ajax({
                    url:ctx+'/plan/dspPlan/queryDspOrder',
                    data:{'planId':planId,'bidStatus':bidStatus},
                    type:'post',
                    dataType:'json',
                    success:function(data){
                        var  list=data.obj;
                        console.log(list);

                        if(list&&list.length>0){

                            var html_='<tr   id="order_'+planId+'"><td  colspan="16">'
                                +'<table id="orderTable_'+planId+'"'
                                +'	class="table table-striped table-bordered table-condensed">'
                                +'	<thead>'
                                +'	  <tr>'
                                +'		<th>编码</th>'
                                +'		<th>投放状态</th>'
                                +'		<th>订单名称</th>'
                                +'		<th>投放周期</th>'
                                +'		<th>余额</th>'
                                +'		<th>总消费</th>'
                                +'		<th>日消费</th>'
                                +' 		<th>操作</th>'
                                +'	</tr>'
                                +'</thead>';

                            for(var i=0;i<list.length;i++){
                                html_+='	'
                                    +'<tr>'
                                    +'	<td><a  href="'+ctx+'/order/dspOrder/form?id='+list[i].id+'">'+list[i].id +'</a></td>'
                                    +'	<td>';

                                if(list[i].bidStatus){

                                    if(list[i].bidStatus=='1'){
                                        html_+='<span class="plan-state  plan-state-start"  onclick="exchange(\'order\',\''+list[i].id+'\',this)"></span>';
                                    }else if(list[i].bidStatus=='0'||list[i].bidStatus=='2'){
                                        html_+='<span class="plan-state"  onclick="exchange(\'order\',\''+list[i].id+'\',this)"></span>';
                                    }else{
                                        html_+='<span class="plan-state"></span>';
                                    }
                                }

                                html_+='</td>'
                                        /* 							+'<td>'
                                         +getDictLabel([{"id":"135","isNewRecord":false,"createDate":"2016-02-02 14:47:46","updateDate":"2016-02-02 14:47:46","parentIds":"0,","sort":30,"value":"0","label":"启用","type":"valid_status","description":"有效性：启用","parentId":"0"},{"id":"136","isNewRecord":false,"createDate":"2016-02-02 14:48:38","updateDate":"2016-02-02 14:48:38","parentIds":"0,","sort":40,"value":"1","label":"停用","type":"valid_status","description":"有效性：停用","parentId":"0"}],list[i].validStatus)+'</td>' */
                                    +'  <td>'+list[i].orderName+'</td>'
                                    +'  <td>'+list[i].createDate+'</td>'
                                        /* +'	<td class="input-td-pos">'
                                         +'		<div class="rowCellEdit-div"><span class="icon-edit	 pointer  order-rowCellEdit" ></span>'+list[i].frequencyNum+'-'+list[i].frequencyTime+'</div>'
                                         +'      <div  class="input-group input-group-freq-pos editDiv  order-input-group-pos" >'
                                         +'		<input name="id" class="input" type="hidden"  name="id" value="'+list[i].id+'" />'
                                         +'		<input name="frequencyNum" class="frequencyNum-freq-text input" type="text" maxlength="6"'
                                         +'        size="10" value="'+(list[i].frequencyNum==undefined?'':list[i].frequencyNum)+'"  class=" digits" />次/'
                                         +'		<select name="frequencyTime" class="input">';
                                         if(list[i].frequencyTime == '0'){
                                         html_+='	<option value="0" selected="selected">时</option> '
                                         +'			<option value="1">天</option> ';
                                         }else if(list[i].frequencyTime == '1'){
                                         html_+='	<option value="0"  >时</option> '
                                         +'			<option value="1"  selected="selected">天</option> ';
                                         }else{
                                         html_+='	<option value="0"  >时</option> '
                                         +'		<option value="1"  >天</option> ';
                                         }
                                         html_+='		</select>		&nbsp;&nbsp;'
                                         +'		<span class="icon icon-remove order-input-group-remove pointer" ></span>'
                                         +'		|'
                                         +'		<span class="icon icon-ok pointer order-input-group-submit"></span>'
                                         +'</div>'
                                         +'</td>'
                                         +'	<td class="input-td-pos"><div  class="rowCellEdit-div"><span class="icon-edit	 pointer  order-rowCellEdit" ></span>'+list[i].budget+'</div>'
                                         +'<div  class="input-group  order-input-group-pos  editDiv" >'
                                         +'		<input name="id" class="input" type="hidden"  name="id" value="'+list[i].id+'" />'
                                         +'	<input name="budget" class="frequencyNum-budget-text  input" type="text" maxlength="10"   size="10" value="'+list[i].budget+'"  class=" digits"/>'
                                         +'	&nbsp;&nbsp;'
                                         +'	<span class="icon icon-remove order-input-group-remove pointer" ></span>'
                                         +'	|'
                                         +'	<span class="icon icon-ok pointer order-input-group-submit"></span>'
                                         +'</div>'
                                         +'</td>'
                                         +'<td class="input-td-pos"><div class="rowCellEdit-div"><span class="icon-edit	  pointer order-rowCellEdit" ></span>'+

                                         getDictLabel([{"id":"ccb72e827dde43fc98bffbdd238ad190","isNewRecord":false,"createDate":"2016-01-27 13:10:22","updateDate":"2016-01-27 13:10:22","parentIds":"0,","sort":10,"value":"fast","label":"加速","type":"BudgetAllocation","description":"加速","parentId":"0"},{"id":"0a476cfffcba4ff19a775e000f5e7ee6","isNewRecord":false,"createDate":"2016-01-27 13:10:07","updateDate":"2016-01-27 13:10:07","parentIds":"0,","sort":10,"value":"avg","label":"匀速","type":"BudgetAllocation","description":"匀速","parentId":"0"}],list[i].BudgetAllocation)
                                         +'-'+list[i].budgetDistributeVal+'-'+
                                         getDictLabel([{"id":"2431d9cfead447c4a1dfd8410d075bd1","isNewRecord":false,"createDate":"2016-01-27 13:11:56","updateDate":"2016-01-27 13:11:56","parentIds":"0,","sort":20,"value":"day","label":"天","type":"BudgetUnit","description":"天","parentId":"0"},{"id":"c15c3ec5266742838750985f85858f6c","isNewRecord":false,"createDate":"2016-01-27 13:12:07","updateDate":"2016-01-27 13:12:07","parentIds":"0,","sort":30,"value":"hour","label":"小时","type":"BudgetUnit","description":"小时","parentId":"0"}],list[i].BudgetUnit)
                                         +'</div>'
                                         +'<div  class="input-group editDiv input-group-freq-pos order-input-group-pos" >'

                                         +'	<input name="id" class="input"  type="hidden"  name="id" value="'+list[i].id+'" />'
                                         +'		<select name="BudgetAllocation" class="input">';
                                         if(list[i].frequencyTime == '0'){
                                         html_+='	<option value="" >全部</option> '
                                         +'	    <option value="0" selected="selected">匀速</option> '
                                         +'		<option value="1">加速</option> ';
                                         }else if(list[i].frequencyTime == '1'){
                                         html_+='	<option value="" >全部</option> '
                                         +'		<option value="0"  >匀速</option> '
                                         +'		<option value="1"  selected="selected">天</option> ';
                                         }else{
                                         html_+='	<option value="" >全部</option> '
                                         +'	<option value="0"  >加速</option> '
                                         +'		<option value="1"  >匀速</option> ';
                                         }
                                         html_+='		</select>		&nbsp;&nbsp;'
                                         +'	<input name="budgetDistributeVal" class="frequencyNum-budget-text  input" type="text" maxlength="10"   size="10" value="'+list[i].budgetDistributeVal+'"  class=" digits"/>'
                                         +'		<select name="BudgetUnit" class="input">';
                                         if(list[i].frequencyTime == '0'){
                                         html_+='	<option value="0" selected="selected">时</option> '
                                         +'			<option value="1">天</option> ';
                                         }else if(list[i].frequencyTime == '1'){
                                         html_+='	<option value="0"  >时</option> '
                                         +'			<option value="1"  selected="selected">天</option> ';
                                         }else{
                                         html_+='	<option value="0"  >时</option> '
                                         +'		<option value="1"  >天</option> ';
                                         }
                                         html_+='		</select>		&nbsp;&nbsp;'
                                         +'	<span class="icon icon-remove order-input-group-remove pointer" ></span>'
                                         +'	|'
                                         +'	<span class="icon icon-ok pointer order-input-group-submit"></span>'
                                         +'</div>'
                                         +'</td>'
                                         +'  <td>'
                                         +getDictLabel([{"id":"da86ec30ca154ad79d96a64bccefffbf","isNewRecord":false,"createDate":"2016-01-26 14:49:55","updateDate":"2016-01-26 14:49:55","parentIds":"0,","sort":10,"value":"0","label":"受众购买","type":"orderStrategy","description":"受众购买","parentId":"0"},{"id":"91fc95de665347edaf13f922e2e52968","isNewRecord":false,"createDate":"2016-01-26 14:50:26","updateDate":"2016-01-26 14:50:26","parentIds":"0,","sort":20,"value":"1","label":"访客召回","type":"orderStrategy","description":"访客召回","parentId":"0"}],list[i].orderStrategy)

                                         +'</td>' */
                                    +'	<td>1</td>'
                                    +'	<td>2</td>'
                                    +'	<td>3</td>'
                                    +'	<td>'
                                    +'<a href="'+ctx+'/order/dspOrder/form?id='+list[i].id+'"><span class="icon-pencil" >编辑</span></a>'
                                    +'<a href="'+ctx+'/report/rpOrder/form?id='+list[i].id+'">报表</a>'
                                    +'</td>'
                                    +'</tr>';
                            }
                            html_+='</table></td></tr>';
                            $(html_).insertAfter($(this_).parent().parent());
                            eventbind();
                        }else{

                        }
                    }

                });
                $(this_).removeClass("icon-plus");
                $(this_).addClass("icon-minus");
            }else{
                if($("#order_"+planId)){
                    $("#order_"+planId).remove();
                }

                $(this_).removeClass("icon-minus");
                $(this_).addClass("icon-plus");
            }
        }

        /**
         *
         *绑定事件
         *
         **/
        function   eventbind(){
            $(".order-rowCellEdit").click(function(){
                changeStatus();
                $(this).parent().hide();
                $(this).parent().next().show();
            });

            //编辑 取消
            $(".order-input-group-remove").click(function(){
                $(this).parent().hide();
                $(this).parent().prev().show();
            });

            //编辑 提交
            $(".order-input-group-submit").click(function(){
                var strObj="{";
                $(this).parent().find('.input').each(function(){
                    if($(this).is('input[type="hidden"]')||$(this).is('input[type="text"]')){
                        var a=$(this).val();
                        var b=$(this).attr('name');
                        strObj+="'"+b+"' :'"+a+"',";
                        //console.log(b+":"+a);
                    }
                    if($(this).is('input[type="radio"]:checked')){
                        var b1=$(this).attr('name');
                        var a1=$(this).val();
                        strObj+="'"+b1+"' :'"+a1+"',";
                        //console.log(b1+":"+a1);
                    }
                    if($(this).is('select')){
                        var b2=$(this).attr('name');
                        var a2=$(this).val();
                        strObj+="'"+b2+"' :'"+a2+"',";
                    }
                });
                strObj=strObj.substr(0,strObj.length-1);
                strObj+="}";
                var obj= eval('(' + strObj + ')');
                $.ajax({
                    url:ctx+'/plan/dspPlan/updateOrder',
                    data:obj,
                    type:'post',
                    dataType:'json',
                    success:function(data){
                        location.reload();
                    }
                });

                $(this).parent().hide();
                $(this).parent().prev().show();

            });
        }

        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
    </script>

</head><style type="text/css" id="856967083356"></style>
<body>

<div class="container-fluid">
    <ul class="nav nav-tabs mar0">
        <li class="active"><a href="/DSP/plan/dspPlan/">活动信息列表</a></li>
        <li><a href="/DSP/plan/dspPlan/form">活动信息添加</a></li>
    </ul>
    <div class="container-fluid container-border">



        <div class="mt15 clearfix">
            <button class="btn btn-primary btn-sm" type="button" onClick="window.location.reload();"><span class="icon icon-refresh"></span> 刷新当前页面</button>
            <!-- <div id="reportrange" class="span3 dateRange pull-right timeList mBottom15">
                <span id="searchDateRange"></span>
                <b class="caret"></b>
            </div> -->
        </div>
        <div class="breadcrumb">
            <div class="clearfix">

                <div class="btn-group pull-left">
                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        新建投放<span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="/DSP/plan/dspPlan/form">新建活动</a></li>
                        <li><a href="/DSP/order/dspOrder/form">新建订单</a></li>
                    </ul>
                </div>

                <div style="float:left;margin-left: 5px">
                    <form id="searchForm" class=" form-search  form-inline mar0" action="/DSP/plan/dspPlan/?bidStatus=1" method="post">
                        <input id="pageNo" name="pageNo" type="hidden" value="1">
                        <input id="pageSize" name="pageSize" type="hidden" value="30">
                        <ul class="ul-form">
                            <li><label>编码：</label>
                                <input name="ids" type="text" htmlescape="false" maxlength="50" class="input-medium">
                            </li>
                            <li><label>活动名称：</label>
                                <input id="planName" name="planName" class="input-medium" type="text" value="" maxlength="50"></li>
                            <li><label>广告主：</label> <input id="memberName" name="memberName" class="input-medium" type="text" value="" maxlength="50"></li>
                            <li class="btns"><button id="btnSubmit" class="btn btn-primary" type="submit"><span class="icon-search"></span> 查询</button>
                            </li>
                            <li class="clearfix"></li>
                        </ul>
                    </form>
                </div>
                <div class="ad-high-set pull-right">高级选项 <span class="icon icon-chevron-right"></span></div>
            </div>


            <!--  批量操作  -->

            <div class=" ad-high-search hide">
                <form id="batchUpdateForm" class="form-search" action="/DSP/plan/dspPlan/list?bidStatus=1" method="post">
                    <input type="hidden" id="planList" name="planList" value="">
                    <ul class="ul-form">
                        <li><button class="btn btn-primary plan-check-all" type="button">全选</button></li>
                        <li><label>投放状态：</label>
                            <div class="select2-container input-xlarge controls-width" id="s2id_bidStatus"><a href="javascript:void(0)" onClick="return false;" class="select2-choice" tabindex="-1">   <span class="select2-chosen">请选择</span><abbr class="select2-search-choice-close"></abbr>   <span class="select2-arrow"><b></b></span></a><input class="select2-focusser select2-offscreen" type="text" id="s2id_autogen1"><div class="select2-drop select2-display-none select2-with-searchbox">   <div class="select2-search">       <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input">   </div>   <ul class="select2-results">   </ul></div></div><select name="bidStatus" class="input-xlarge controls-width select2-offscreen" id="bidStatus" tabindex="-1">
                                <option value="">请选择</option>
                                <option value="1">开启</option>
                                <option value="2">暂停</option>
                            </select>
                        </li>
                        <!--   <li>
                              <label>活动预算：</label>
                              <input class="order-input" id="budget" name ="budget" type="text" />
                          </li> -->
                        <li>
                            <label>每日预算：</label>
                            <input class="order-input" id="budgetPerDay" maxlength="10" name="budgetPerDay" type="text">
                        </li>
                        <li><label>活动频次：</label>
                            <input class="order-input" id="frequencyNum" type="text" maxlength="3" name="frequencyNum">
                            <div class="select2-container input" id="s2id_frequencyTime"><a href="javascript:void(0)" onClick="return false;" class="select2-choice" tabindex="-1">   <span class="select2-chosen">请选择</span><abbr class="select2-search-choice-close"></abbr>   <span class="select2-arrow"><b></b></span></a><input class="select2-focusser select2-offscreen" type="text" id="s2id_autogen2"><div class="select2-drop select2-display-none select2-with-searchbox">   <div class="select2-search">       <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input">   </div>   <ul class="select2-results">   </ul></div></div><select id="frequencyTime" name="frequencyTime" class="input select2-offscreen" tabindex="-1">
                                <option value="" selected="selected">请选择</option>
                                <option value="day">天</option><option value="hour">小时</option>
                            </select>
                        </li>
                        <input id="plan-checked-val" name="ids" type="hidden">
                        <li>
                            <button type="button" class="btn btn-primary order-search-btn" id="batch-save">批量保存</button>
                        </li>
                    </ul>
                </form>
            </div>
            <!-- 批量操作 -->
        </div>
        <div id="subtips"></div>
















        <script type="text/javascript">top.$.jBox.closeTip();</script>


        <table id="contentTable" class="table table-striped table-bordered table-condensed plan-table-select">
            <thead>
            <tr>
                <th></th>
                <th>编码</th>
                <th>状态</th>
                <th>活动名称</th>
                <th>活动类型</th>
                <th>广告主</th>
                <th>投放周期</th>
                <!-- <th>余额</th>
                <th>总消费</th>
                <th>日消费</th> -->

                <th>操作  <span class="icon icon-refresh pointer"></span></th>

            </tr>
            </thead>
            <tbody>

            <tr>
                <td><input name="Fruit" type="checkbox" value="00522"></td>
                <td>00522</td>
                <td>



                    <span class="plan-state  plan-state-start" onClick="exchange('plan','00522',this)"></span>




                </td>
                <td><span class="expland_a pointer icon-plus" onClick="appendTB('1','00522',this)"></span>
                    <a href="/DSP/plan/dspPlan/form?id=00522">广告活动1 </a>
                </td>
                <td>
                    PC端
                </td>
                <td>
                    广告公司测试名称
                </td>
                <td>
                    2017-04-06 11:26:13
                </td>
                <!-- <td>0.0</td> -->





                <td>
                    <a href="/DSP/plan/dspPlan/form?id=00522"><span>查看</span></a>
                    <a href="/DSP/report/rpMain/page?id=00522" target="_blank"><span>活动报表</span></a>
                </td>

            </tr>

            </tbody>
        </table>
        <div class="pagination"><ul>
            <li class="disabled"><a href="javascript:">« 上一页</a></li>
            <li class="active"><a href="javascript:">1</a></li>
            <li class="disabled"><a href="javascript:">下一页 »</a></li>
            <li class="disabled controls"><a href="javascript:">当前第<input readonly="true" type="text" value="1" onKeyPress="var e=window.event||this;var c=e.keyCode||e.which;if(c==13)page(this.value,30,'');" onClick="this.select();"> 页 每页<input readonly="true" type="text" value="30" onKeyPress="var e=window.event||this;var c=e.keyCode||e.which;if(c==13)page(1,this.value,'');" onClick="this.select();"> 条，共 1 条</a></li>
        </ul>
            <div style="clear:both;"></div></div>
        <!-- Modal -->
        <div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" onClick="cancelCode('data-code-list')" aria-label="Close"><span aria-hidden="true">×</span></button>
                        <h4 class="modal-title" id="myModalLabel">提示信息</h4>
                    </div>
                    <div class="modal-body">
                        <p class="tip-danger">确定要批量修改选中的活动吗？</p>
                    </div>
                    <div class="modal-footer">
                        <button id="data-sure" type="button" class="btn btn-primary">确定</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal hide" id="order-modal" tabindex="-2" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" onClick="cancelCode('data-code-list')" aria-label="Close"><span aria-hidden="true">×</span></button>
                        <h4 class="modal-title" id="myModalLabel">提示信息</h4>
                    </div>
                    <div class="modal-body">
                        <p class="tip-danger">确定要修改当前活动状态吗？</p>
                    </div>
                    <div class="modal-footer">
                        <button id="order-status" type="button" class="btn btn-primary">确定</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal hide" id="offOrder-modal" tabindex="-3" role="dialog" aria-labelledby="offOrder-modal">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" onClick="cancelCode('data-code-list')" aria-label="Close"><span aria-hidden="true">×</span></button>
                        <h4 class="modal-title">提示信息</h4>
                    </div>
                    <div class="modal-body">
                        <p class="tip-danger"></p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function removeTip(){
        setTimeout(function(){
            $('.alert-tip').remove();
        },5000);
    }

    $(function(){
        //高级选项按钮
        $('.ad-high-set').click(function(){
            var _this=$(this);
            if(_this.parent().next().hasClass('hide')){
                _this.addClass('ad-high-setborder');
                _this.parent().next().removeClass('hide');
                _this.children().addClass('icon-chevron-down').removeClass('icon-chevron-right');
            }else{
                _this.removeClass('ad-high-setborder');
                _this.parent().next().addClass('hide');
                _this.children().addClass('icon-chevron-right').removeClass('icon-chevron-down');
            };
        });
        //全选按钮
        $('.plan-check-all').click(function(){ //全选点击
            var _this=$(this);
            var str='';
            var _table=$('#contentTable');
            if(_this.hasClass('plan-checked-all')){ //判断是否含有全选的class
                _this.removeClass('plan-checked-all'); //移除全选class
                _table.find('input[name="Fruit"]').attr('checked',false);//设置table的checkbox 为false
                $('#plan-checked-val').val(''); //清空隐藏域的值
            }else{
                _this.addClass('plan-checked-all'); //添加全选class
                _table.find('input[name="Fruit"]').attr('checked',true); //设置table中的checkbox 为true
                _table.find('input[name="Fruit"]').each(function(){ //循环取得所有的订单ID
                    var _this=$(this);
                    str+=_this.val()+',';
                });
                str=str.substring(0,str.length-1); //去掉最后一个都好
                $('#plan-checked-val').val(str); //给隐藏域赋值

            };
        });
        $('#contentTable input[name="Fruit"]').click(function(){ //单选点击
            var str='';
            var _table=$('#contentTable');
            _table.find('input[name="Fruit"]:checked').each(function(){ //循环取得所有的val值
                var _this=$(this);
                str+=_this.val()+',';
            });
            str=str.substring(0,str.length-1); //去掉最后一个逗号
            $('#plan-checked-val').val(str); //给隐藏域赋值
        });

        /********* 高级选项设置 验证 二次弹出框确定 start ************/
        $('.order-input').focus(function(){
            $('.alert-tip').remove();
        });

        var reg=/^(0|[1-9][0-9]*)$/;
        var bugetReg=/^(\d|([1-9]\d+))(\.\d{1,2})?$/;
        $('.order-input').blur(function(){
            var _this=$(this);
            var str=_this.val();
            var _alert='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>只能输入数字，请重新输入数值！</span>'
                +'</div>';
            var _alert2='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>活动频次请输入不以0开始的整数!</span>'
                +'</div>';
            var _alert3='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>每日预算请输入不以0开始的整数</span>'
                +'</div>';
            var _alert4='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>每日预算不能为空!</span>'
                +'</div>';
            var _alert5='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>活动频次不能为空!</span>'
                +'</div>';


            removeTip();
            if(isNaN(str)==true){
                _this.val('');
                $('.breadcrumb').append(_alert);
                return false;
            }

            if(_this.attr('name')=='budgetPerDay'){
                if(_this.val()==''){
                    $('.breadcrumb').append(_alert4);
                    return false;
                }
                if(!reg.test(str)){
                    _this.val('');
                    $('.breadcrumb').append(_alert3);
                    return false;
                }
            }

            if(_this.attr('name')=='frequencyNum'){
                if(_this.val()==''){
                    $('.breadcrumb').append(_alert5);
                    return false;
                }
                if(!reg.test(str)){
                    _this.val('');
                    $('.breadcrumb').append(_alert2);
                    return false;
                }
            }
        });

        $('#batch-save').click(function(){
            var str=$('#plan-checked-val').val();
            var _alert='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>请最少选择表格中的一个活动！</span>'
                +'</div>';
            var _alert2='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>活动频次修改时请选择时间控制！</span>'
                +'</div>';
            var _alert3='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>请最少选择一个修改项！</span>'
                +'</div>';
            var _alert4='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>每日预算请输入正整数或者小数点后两位的浮点数！</span>'
                +'</div>';
            var _alert5='<div class="alert alert-danger alert-tip mt10">'
                +'<button data-dismiss="alert" class="close">×</button>'
                +'<span>活动频次请输入正整数！</span>'
                +'</div>';
            var optionVal=$('#frequencyTime option:selected').val();

            $('.alert-tip').remove();
            removeTip();
            if(str==''){
                $('.breadcrumb').append(_alert);
                return false;
            }

            if($('#bidStatus option:selected').val()=='' && $('#budgetPerDay').val()=='' && $('#frequencyNum').val()==''&&$('#frequencyTime').val()==''){
                $('.breadcrumb').append(_alert3);
                return false;
            }

            if($('#budgetPerDay').val()!=''){
                if(!bugetReg.test($('#budgetPerDay').val())){
                    $('#budgetPerDay').val('');
                    $('.breadcrumb').append(_alert4);
                    return false;
                }
            }

            if($('#frequencyNum').val()!=''){
                if(!reg.test($('#frequencyNum').val())){
                    $('#frequencyNum').val('');
                    $('.breadcrumb').append(_alert2);
                    return false;
                }
            }


            if($('#frequencyNum').val()!='' || optionVal!=''){
                if(optionVal==''){
                    $('.breadcrumb').append(_alert2);
                    return false;
                }
                if($('#frequencyNum').val()==''){
                    $('.breadcrumb').append(_alert2);
                    return false;
                }
            }
            removeTip();

            $('#myModal').modal('show');
        });

        $('#data-sure').click(function(){
            batchUpdate();
        });
        /********* 高级选项设置 验证 二次弹出框确定 end ************/
    });

    //批量更新
    function batchUpdate(){
        $.ajax({
            url:ctx+'/plan/dspPlan/batchUpdate',
            data:$("#batchUpdateForm").serialize(),
            type:'post',
            dataType:'json',
            async:true,
            success:function(data){
                if(data.msg&&data.msg!=''){
// 	 					var str=data.substring(0,data.length-1);
// 		        		var tipHtml='批量修改中订单编号为'+str+'为禁用订单，未能修改！';
                    $('#offOrder-modal .tip-danger').html(data.msg);
                    $('#myModal').modal('hide');
                    $('#offOrder-modal').modal('show');

                    $('#offOrder-sure').click(function(){
                        $('#offOrder-modal').modal('hide');
                        location.reload();
                    });

                    $('#offOrder-modal').on('hidden.bs.modal', function (e) {
                        location.reload();
                    });
                }
                location.reload();
                /* 	 				if($(ithis).hasClass('plan-state-start')){
                 $(ithis).removeClass('plan-state-start');
                 }else{
                 $(ithis).addClass('plan-state-start');
                 } */
            }
        });
    }
</script>

<script type="text/javascript">//<!-- 无框架时，左上角显示菜单图标按钮。
if(!(self.frameElement && self.frameElement.tagName=="IFRAME")){
    $("body").prepend("<i id=\"btnMenu\" class=\"icon-th-list\" style=\"cursor:pointer;float:right;margin:10px;\"></i><div id=\"menuContent\"></div>");
    $("#btnMenu").click(function(){
        top.$.jBox('get:/DSP/sys/menu/treeselect;JSESSIONID=f18bc4a41137477ca9878e8026215f9d', {title:'选择菜单', buttons:{'关闭':true}, width:300, height: 350, top:10});
        //if ($("#menuContent").html()==""){$.get("/DSP/sys/menu/treeselect", function(data){$("#menuContent").html(data);});}else{$("#menuContent").toggle(100);}
    });
}//-->
</script>

</body></html>